package com.lagou.edu.demo.controller;

import com.lagou.edu.demo.service.IDemoService;
import com.lagou.edu.lagouframework.annotations.LagouAutowired;
import com.lagou.edu.lagouframework.annotations.LagouController;
import com.lagou.edu.lagouframework.annotations.LagouRequestMapping;
import com.lagou.edu.lagouframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author xq
 * @description controller
 * @date 2021/05/18 20:04:24
 **/
@LagouController
@LagouRequestMapping("/demo")
@LagouSecurity({"zhangsan","lisi"})
public class DemoController {

    @LagouAutowired
    private IDemoService demoService;

    @LagouRequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response, String name) throws IOException {
        demoService.query(name);
        response.setHeader("Content-type", "text/html;charset=UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write("欢迎您:"+name);
        return;
    }
}
